Share the same name for xenbus transaction type between user and kernel
authorvhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com>
Wed, 11 Jan 2006 11:46:32 +0000 (11:46 +0000)
committervhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com>
Wed, 11 Jan 2006 11:46:32 +0000 (11:46 +0000)
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
tools/python/xen/lowlevel/xs/xs.c
tools/xenstore/xenstore_client.c
tools/xenstore/xs.c
tools/xenstore/xs.h
tools/xenstore/xs_test.c

index 35c3c0cf6a4f943cc4f0927694bc717e6dd98713..5f6d1850f41fff4b086b409671faa0e20d3e8d34 100644 (file)
@@ -66,7 +66,7 @@ static PyObject *none(bool result);
 
 static int parse_transaction_path(XsHandle *self, PyObject *args,
                                   struct xs_handle **xh,
-                                  xs_transaction_handle *th,
+                                  xs_transaction_t *th,
                                   char **path);
 
 
@@ -83,7 +83,7 @@ static int parse_transaction_path(XsHandle *self, PyObject *args,
 static PyObject *xspy_read(XsHandle *self, PyObject *args)
 {
     struct xs_handle *xh;
-    xs_transaction_handle th;
+    xs_transaction_t th;
     char *path;
 
     char *xsval;
@@ -120,7 +120,7 @@ static PyObject *xspy_write(XsHandle *self, PyObject *args)
 {
     static char *arg_spec = "sss#";
     struct xs_handle *xh = xshandle(self);
-    xs_transaction_handle th;
+    xs_transaction_t th;
     char *thstr;
     char *path;
     char *data;
@@ -132,7 +132,7 @@ static PyObject *xspy_write(XsHandle *self, PyObject *args)
     if (!PyArg_ParseTuple(args, arg_spec, &thstr, &path, &data, &data_n))
         return NULL;
 
-    th = (xs_transaction_handle)strtoul(thstr, NULL, 16);
+    th = (xs_transaction_t)strtoul(thstr, NULL, 16);
 
     Py_BEGIN_ALLOW_THREADS
     result = xs_write(xh, th, path, data, data_n);
@@ -155,7 +155,7 @@ static PyObject *xspy_write(XsHandle *self, PyObject *args)
 static PyObject *xspy_ls(XsHandle *self, PyObject *args)
 {
     struct xs_handle *xh;
-    xs_transaction_handle th;
+    xs_transaction_t th;
     char *path;
 
     char **xsval;
@@ -193,7 +193,7 @@ static PyObject *xspy_ls(XsHandle *self, PyObject *args)
 static PyObject *xspy_mkdir(XsHandle *self, PyObject *args)
 {
     struct xs_handle *xh;
-    xs_transaction_handle th;
+    xs_transaction_t th;
     char *path;
 
     bool result;
@@ -221,7 +221,7 @@ static PyObject *xspy_mkdir(XsHandle *self, PyObject *args)
 static PyObject *xspy_rm(XsHandle *self, PyObject *args)
 {
     struct xs_handle *xh;
-    xs_transaction_handle th;
+    xs_transaction_t th;
     char *path;
 
     bool result;
@@ -256,7 +256,7 @@ static PyObject *xspy_get_permissions(XsHandle *self, PyObject *args)
     unsigned int perms_n = 0;
     int i;
 
-    xs_transaction_handle th;
+    xs_transaction_t th;
     char *thstr;
 
     if (!xh)
@@ -264,7 +264,7 @@ static PyObject *xspy_get_permissions(XsHandle *self, PyObject *args)
     if (!PyArg_ParseTuple(args, arg_spec, &thstr, &path))
         return NULL;
 
-    th = (xs_transaction_handle)strtoul(thstr, NULL, 16);
+    th = (xs_transaction_t)strtoul(thstr, NULL, 16);
 
     Py_BEGIN_ALLOW_THREADS
     perms = xs_get_permissions(xh, th, path, &perms_n);
@@ -312,7 +312,7 @@ static PyObject *xspy_set_permissions(XsHandle *self, PyObject *args)
     int xsperms_n;
     PyObject *tuple0 = NULL;
 
-    xs_transaction_handle th;
+    xs_transaction_t th;
     char *thstr;
 
     if (!xh)
@@ -320,7 +320,7 @@ static PyObject *xspy_set_permissions(XsHandle *self, PyObject *args)
     if (!PyArg_ParseTuple(args, "ssO", &thstr, &path, &perms))
         goto exit;
 
-    th = (xs_transaction_handle)strtoul(thstr, NULL, 16);
+    th = (xs_transaction_t)strtoul(thstr, NULL, 16);
 
     if (!PyList_Check(perms)) {
         PyErr_SetString(PyExc_RuntimeError, "perms must be a list");
@@ -509,7 +509,7 @@ static PyObject *xspy_unwatch(XsHandle *self, PyObject *args)
 static PyObject *xspy_transaction_start(XsHandle *self)
 {
     struct xs_handle *xh = xshandle(self);
-    xs_transaction_handle th;
+    xs_transaction_t th;
     char thstr[MAX_STRLEN(unsigned long) + 1];
 
     if (!xh)
@@ -547,7 +547,7 @@ static PyObject *xspy_transaction_end(XsHandle *self, PyObject *args,
     struct xs_handle *xh = xshandle(self);
     bool result;
 
-    xs_transaction_handle th;
+    xs_transaction_t th;
     char *thstr;
 
     if (!xh)
@@ -556,7 +556,7 @@ static PyObject *xspy_transaction_end(XsHandle *self, PyObject *args,
                                      &thstr, &abort))
         return NULL;
 
-    th = (xs_transaction_handle)strtoul(thstr, NULL, 16);
+    th = (xs_transaction_t)strtoul(thstr, NULL, 16);
 
     Py_BEGIN_ALLOW_THREADS
     result = xs_transaction_end(xh, th, abort);
@@ -727,7 +727,7 @@ static void remove_watch(XsHandle *self, PyObject *token)
  */
 static int parse_transaction_path(XsHandle *self, PyObject *args,
                                   struct xs_handle **xh,
-                                  xs_transaction_handle *th,
+                                  xs_transaction_t *th,
                                   char **path)
 {
     char *thstr;
@@ -740,7 +740,7 @@ static int parse_transaction_path(XsHandle *self, PyObject *args,
     if (!PyArg_ParseTuple(args, "ss", &thstr, path))
         return 0;
 
-    *th = (xs_transaction_handle)strtoul(thstr, NULL, 16);
+    *th = (xs_transaction_t)strtoul(thstr, NULL, 16);
 
     return 1;
 }
index 5090499af3d9ceab7ddac5f2099648eab2c65e07..deb63453d3163b45b142275233855e3686312445 100644 (file)
@@ -66,7 +66,7 @@ usage(const char *progname)
 
 #if defined(CLIENT_rm)
 static int
-do_rm(char *path, struct xs_handle *xsh, xs_transaction_handle xth)
+do_rm(char *path, struct xs_handle *xsh, xs_transaction_t xth)
 {
     if (xs_rm(xsh, xth, path)) {
         return 0;
@@ -81,7 +81,7 @@ do_rm(char *path, struct xs_handle *xsh, xs_transaction_handle xth)
 
 static int
 perform(int optind, int argc, char **argv, struct xs_handle *xsh,
-        xs_transaction_handle xth, int prefix, int tidy)
+        xs_transaction_t xth, int prefix, int tidy)
 {
     while (optind < argc) {
 #if defined(CLIENT_read)
@@ -179,7 +179,7 @@ int
 main(int argc, char **argv)
 {
     struct xs_handle *xsh;
-    xs_transaction_handle xth;
+    xs_transaction_t xth;
     int ret = 0, socket = 0;
     int prefix = 0;
     int tidy = 0;
index 3ecb462ea3014b0456e03b15ddd80a0dc2ae0f56..8332e1aad5a19a8f5c1d9bb6603f700532d423f8 100644 (file)
@@ -292,7 +292,7 @@ static void *read_reply(
 }
 
 /* Send message to xs, get malloc'ed reply.  NULL and set errno on error. */
-static void *xs_talkv(struct xs_handle *h, xs_transaction_handle t,
+static void *xs_talkv(struct xs_handle *h, xs_transaction_t t,
                      enum xsd_sockmsg_type type,
                      const struct iovec *iovec,
                      unsigned int num_vecs,
@@ -368,7 +368,7 @@ static void free_no_errno(void *p)
 }
 
 /* Simplified version of xs_talkv: single message. */
-static void *xs_single(struct xs_handle *h, xs_transaction_handle t,
+static void *xs_single(struct xs_handle *h, xs_transaction_t t,
                       enum xsd_sockmsg_type type,
                       const char *string,
                       unsigned int *len)
@@ -388,7 +388,7 @@ static bool xs_bool(char *reply)
        return true;
 }
 
-char **xs_directory(struct xs_handle *h, xs_transaction_handle t,
+char **xs_directory(struct xs_handle *h, xs_transaction_t t,
                    const char *path, unsigned int *num)
 {
        char *strings, *p, **ret;
@@ -420,7 +420,7 @@ char **xs_directory(struct xs_handle *h, xs_transaction_handle t,
  * Returns a malloced value: call free() on it after use.
  * len indicates length in bytes, not including the nul.
  */
-void *xs_read(struct xs_handle *h, xs_transaction_handle t,
+void *xs_read(struct xs_handle *h, xs_transaction_t t,
              const char *path, unsigned int *len)
 {
        return xs_single(h, t, XS_READ, path, len);
@@ -429,7 +429,7 @@ void *xs_read(struct xs_handle *h, xs_transaction_handle t,
 /* Write the value of a single file.
  * Returns false on failure.
  */
-bool xs_write(struct xs_handle *h, xs_transaction_handle t,
+bool xs_write(struct xs_handle *h, xs_transaction_t t,
              const char *path, const void *data, unsigned int len)
 {
        struct iovec iovec[2];
@@ -446,7 +446,7 @@ bool xs_write(struct xs_handle *h, xs_transaction_handle t,
 /* Create a new directory.
  * Returns false on failure, or success if it already exists.
  */
-bool xs_mkdir(struct xs_handle *h, xs_transaction_handle t,
+bool xs_mkdir(struct xs_handle *h, xs_transaction_t t,
              const char *path)
 {
        return xs_bool(xs_single(h, t, XS_MKDIR, path, NULL));
@@ -455,7 +455,7 @@ bool xs_mkdir(struct xs_handle *h, xs_transaction_handle t,
 /* Destroy a file or directory (directories must be empty).
  * Returns false on failure, or success if it doesn't exist.
  */
-bool xs_rm(struct xs_handle *h, xs_transaction_handle t,
+bool xs_rm(struct xs_handle *h, xs_transaction_t t,
           const char *path)
 {
        return xs_bool(xs_single(h, t, XS_RM, path, NULL));
@@ -465,7 +465,7 @@ bool xs_rm(struct xs_handle *h, xs_transaction_handle t,
  * Returns malloced array, or NULL: call free() after use.
  */
 struct xs_permissions *xs_get_permissions(struct xs_handle *h,
-                                         xs_transaction_handle t,
+                                         xs_transaction_t t,
                                          const char *path, unsigned int *num)
 {
        char *strings;
@@ -499,7 +499,7 @@ struct xs_permissions *xs_get_permissions(struct xs_handle *h,
  * Returns false on failure.
  */
 bool xs_set_permissions(struct xs_handle *h,
-                       xs_transaction_handle t,
+                       xs_transaction_t t,
                        const char *path,
                        struct xs_permissions *perms,
                        unsigned int num_perms)
@@ -636,7 +636,7 @@ bool xs_unwatch(struct xs_handle *h, const char *path, const char *token)
  * You can only have one transaction at any time.
  * Returns NULL on failure.
  */
-xs_transaction_handle xs_transaction_start(struct xs_handle *h)
+xs_transaction_t xs_transaction_start(struct xs_handle *h)
 {
        char *id_str;
        unsigned long id;
@@ -648,7 +648,7 @@ xs_transaction_handle xs_transaction_start(struct xs_handle *h)
        id = strtoul(id_str, NULL, 0);
        free(id_str);
 
-       return (xs_transaction_handle)id;
+       return (xs_transaction_t)id;
 }
 
 /* End a transaction.
@@ -656,7 +656,7 @@ xs_transaction_handle xs_transaction_start(struct xs_handle *h)
  * Returns false on failure, which indicates an error: transactions will
  * not fail spuriously.
  */
-bool xs_transaction_end(struct xs_handle *h, xs_transaction_handle t,
+bool xs_transaction_end(struct xs_handle *h, xs_transaction_t t,
                        bool abort)
 {
        char abortstr[2];
index 173c4bc564486305ed431dacca3088fe6c103894..55bbcd157ad7cd3edadbb2696a67375e1da6e192 100644 (file)
@@ -25,8 +25,8 @@
 #define XBT_NULL NULL
 
 struct xs_handle;
-struct xs_transaction_handle;
-typedef struct xs_transaction_handle * xs_transaction_handle;
+struct xs_transaction_t;
+typedef struct xs_transaction_t * xs_transaction_t;
 
 /* On failure, these routines set errno. */
 
@@ -48,45 +48,45 @@ void xs_daemon_close(struct xs_handle *);
  * Returns a malloced array: call free() on it after use.
  * Num indicates size.
  */
-char **xs_directory(struct xs_handle *h, xs_transaction_handle t,
+char **xs_directory(struct xs_handle *h, xs_transaction_t t,
                    const char *path, unsigned int *num);
 
 /* Get the value of a single file, nul terminated.
  * Returns a malloced value: call free() on it after use.
  * len indicates length in bytes, not including terminator.
  */
-void *xs_read(struct xs_handle *h, xs_transaction_handle t,
+void *xs_read(struct xs_handle *h, xs_transaction_t t,
              const char *path, unsigned int *len);
 
 /* Write the value of a single file.
  * Returns false on failure.
  */
-bool xs_write(struct xs_handle *h, xs_transaction_handle t,
+bool xs_write(struct xs_handle *h, xs_transaction_t t,
              const char *path, const void *data, unsigned int len);
 
 /* Create a new directory.
  * Returns false on failure, or success if it already exists.
  */
-bool xs_mkdir(struct xs_handle *h, xs_transaction_handle t,
+bool xs_mkdir(struct xs_handle *h, xs_transaction_t t,
              const char *path);
 
 /* Destroy a file or directory (and children).
  * Returns false on failure, or if it doesn't exist.
  */
-bool xs_rm(struct xs_handle *h, xs_transaction_handle t,
+bool xs_rm(struct xs_handle *h, xs_transaction_t t,
           const char *path);
 
 /* Get permissions of node (first element is owner, first perms is "other").
  * Returns malloced array, or NULL: call free() after use.
  */
 struct xs_permissions *xs_get_permissions(struct xs_handle *h,
-                                         xs_transaction_handle t,
+                                         xs_transaction_t t,
                                          const char *path, unsigned int *num);
 
 /* Set permissions of node (must be owner).
  * Returns false on failure.
  */
-bool xs_set_permissions(struct xs_handle *h, xs_transaction_handle t,
+bool xs_set_permissions(struct xs_handle *h, xs_transaction_t t,
                        const char *path, struct xs_permissions *perms,
                        unsigned int num_perms);
 
@@ -116,14 +116,14 @@ bool xs_unwatch(struct xs_handle *h, const char *path, const char *token);
  * You can only have one transaction at any time.
  * Returns NULL on failure.
  */
-xs_transaction_handle xs_transaction_start(struct xs_handle *h);
+xs_transaction_t xs_transaction_start(struct xs_handle *h);
 
 /* End a transaction.
  * If abandon is true, transaction is discarded instead of committed.
  * Returns false on failure: if errno == EAGAIN, you have to restart
  * transaction.
  */
-bool xs_transaction_end(struct xs_handle *h, xs_transaction_handle t,
+bool xs_transaction_end(struct xs_handle *h, xs_transaction_t t,
                        bool abort);
 
 /* Introduce a new domain.
index 03674bd26e2dc60a91c19799f8a700058caebc3f..5a43bc40b75fc7d9fc5d1845b5aa2b14e21edbc7 100644 (file)
@@ -43,7 +43,7 @@
 #define XSTEST
 
 static struct xs_handle *handles[10] = { NULL };
-static xs_transaction_handle txh[10] = { XBT_NULL };
+static xs_transaction_t txh[10] = { XBT_NULL };
 
 static unsigned int timeout_ms = 500;
 static bool timeout_suppressed = true;